# Maintainer: Daniel Espinosa <esodan@gmail.com>

_realname=gxml
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.8.2
pkgrel=1
arch=('any')
pkgdesc="GObject LibXML2 wrapper and Serializer Framework (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-gettext"
         "${MINGW_PACKAGE_PREFIX}-glib2>=2.34.0"
         "${MINGW_PACKAGE_PREFIX}-libgee"
         "${MINGW_PACKAGE_PREFIX}-libxml2"
         "${MINGW_PACKAGE_PREFIX}-xz"
         "${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-libtool"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "make" "autoconf" "automake" "intltool")
license=('LGPL')
url="https://wiki.gnome.org/GXml"

options=('strip' 'staticlibs')
source=("https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz")
sha256sums=('79bb09746ba03d617b7045a486f679a9bd2fb3ec088c2ed6017b27a27d560773')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}

  # Get proper unprefixed directories for gobject-introspection files
  autoreconf -fiv
}

build()
{
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --enable-introspection
  make -j1
}

package()
{
  cd "$srcdir/build-${MINGW_CHOST}"
  make DESTDIR=$pkgdir install
}
